package br.home.jdbc;

import java.sql.*;


public class ConnectionFactory {

	private static Connection connection;
	
	public static Connection getConnection() throws SQLException{
		try {
			Class.forName("com.mysql.jdbc.Driver");
			connection = DriverManager.getConnection("jdbc:mysql://localhost/barraca","root","");  
			return connection;
		} catch (ClassNotFoundException e) {
			throw new SQLException(e.getMessage()); 
			// TODO: handle exception
		}
	}
	
	public static void closseConnection() throws SQLException{
		try {
			connection = null;
		} catch (Exception e) {
			throw new SQLException(e.getMessage());
		}
	}
}
